import java.io.File;

/**
 * Created by eahn on 01/11/13.
 */
public class ComparisonResult {

    public enum ResultType {

        EQUAL, DIFFERENT, ONLY_IN_SRC, ONLY_IN_DEST, NOT_EXISTS, EXISTS_BUT_DIFFERENT, EXISTS_BUT_SHOULD_NOT

    }

    protected File file;
    protected ResultType type;

    protected String relativePath;


    public ComparisonResult(File file, ResultType type, String relativePath) {
        this.file = file;
        this.type = type;
        this.relativePath = relativePath;
        if (!relativePath.endsWith(File.pathSeparator)) {
            this.relativePath += File.separator;
        }
    }

    public String getRelativeFilename() {
        String path = file.getAbsolutePath();
        if (relativePath != null) {
            path = path.replace(relativePath, "");
        }
        return path;
    }

    public String toString() {
        return type + ": " + getRelativeFilename();
    }


    public File getFile() {
        return file;
    }

    public ResultType getType() {
        return type;
    }

    public void setType(ResultType type) {
        this.type = type;
    }

    public String getRelativePath() {
        return relativePath;
    }

    public void setRelativePath(String relativePath) {
        this.relativePath = relativePath;
    }
}
